<extend name="Base/common"/>
<block name="side">
    <div class="sidebar">
        <ul class="side-nav">
            <li >
                <a href="{:U('Home/Tmall/give')}" <if condition="$action eq 'give'">class="active"</if> ><i class="fa-new"></i> 发放优惠券</a>
            </li>
            <li>
                <a href="{:U('Home/Tmall/index')}"  <if condition="$action eq 'index'">class="active"</if> ><i class=" fa-history"></i> 历史记录</a>
            </li>
            <li>
                <a href="{:U('User/profile')}" <if condition="$action eq 'profile'">class="active"</if> ><i class="fa-pass"></i> 修改密码</a>
            </li>
            <li>
                <a href="{:U('User/logout')}" <if condition="$action eq 'logout'">class="active"</if> ><i class="fa-back"></i> 退出系统</a>
            </li>
        </ul>
    </div>
</block>
<block name="body">

    <div id="main-content">
        <div id="main" class="main" style="min-height: 380px;">
            <div class="row">
                <h1>历史记录</h1>
                <div class="admin">
                    欢迎 {:get_nickname()} 登陆系统
                </div>
            </div>
            <div class="search-form">
                <form id="search" action="" method="get" >

                    <div class="sleft">
                        <span class="search-title">姓名</span>
                        <input id="username" class="search-input" type="text" placeholder="" value="" name="username">
                        <span class="search-title">电话</span>
                        <input id="phonenumber" class="search-input" type="text" placeholder="" value="" name="phonenumber">
                        <span class="search-title">车牌号码</span>
                        <input id="platenumber" class="search-input" type="text" placeholder="" value="" name="platenumber">
                        <span class="search-title">淘宝账号</span>
                        <input id="taobao" class="search-input" type="text" placeholder="" value="" name="taobao">
                        <span class="search-title">代金券发放状态</span>
                        <div class="dropdown1">
                            <select id="cashcoupon" class="form-control" name="cashcoupon">
                                <option value="" selected = "selected"></option>
                                <option value="0">未发放</option>
                                <option value="1">已发放</option>
                                <option value="2">已领取</option>
                            </select>
                        </div>
                    </div>
                    <button id="searchSubmit" class="btn ajax-post" target-form="ids" type="submit">搜索</button>
                </form>
                <script>
                    $(function(){
                        $("body").on("blur","input",function(){
                            $(this).val($(this).val().replace(/ +/g,''));
                        });
                        $("#search").submit(function(){
                            var url = "index.php?s=/Home/Tmall/index";
                            $("#search input, #search select").each(function(){
                                console.log($(this).attr("name"));
                                if($(this).val()){
                                    url += '/'+ $(this).attr("name") + '/' + $(this).val();
                                }
                            });
                            url +='.html';
                            console.log(url);
                            location.href=url;
                            return false;
                        });
                    });
                </script>
            </div>
            <div class="table-responsive">
                <table class="table table-hover table-striped">
                    <thead>
                        <tr>
                            <th>查看结算单</th>
                            <th>审核时间</th>
                            <th>活动用户姓名</th>
                            <th>手机号码</th>
                            <th>车牌号码</th>
                            <th>淘宝账号</th>
                            <th>代金券发放</th>
                        </tr>
                    </thead>
                    <tbody>

                        <volist name="list" id="info" key="key">
                            <tr class="record" data-id="{$key}" data-picture="{:get_file($info['statement'],'path')}">
                                <p class="statement_picture" style="display:none;">{:get_file($info['statement'],'path')}</p>

                                <td class="jump-img red" style="cursor:pointer;text-decoration:underline;">点击查看</td>
                                <td>{$info.create_time|date='Y-m-d',###}</td>
                                <td>{$info.username}</td>
                                <td>{$info.phonenumber}</td>
                                <td>{$info.platenumber}</td>
                                <td>{$info.taobao}</td>
                                <if condition="$info.cashcoupon eq 1">
                                    <td class="orange">已发放</td>
                                    <elseif condition="$info.cashcoupon eq 2" />
                                    <td class="green">已领取</td>
                                    <elseif condition="$info.cashcoupon eq 0" />
                                    <td class="red">未发放</td>
                                    <else />
                                </if>
                            </tr>
                        </volist>
                    </tbody>
                </table>
            </div>
            <div class="page">
                <div>
                    {$_page}
                </div>
            </div>
<style>
    .img{
        position: absolute;
        /* width: 100%; */
        margin: auto;
        /* height: 100%; */
        top: 180px;
        left: 400px;
        display:none;
    }
    .current{
        display:block;
    }
</style>
            <div class="img">
                <img id="statement" src="">
            </div>
            <script>
                $(function(){
                    $(".jump-img").click(function(){
                        if($("div.img").attr("class").indexOf("current")>=0){
                            $("div.img").removeClass("current");
                        }else{
                            console.log($(this).parent().data("picture"));
                            $("#statement").attr("src", $(this).parent().data("picture"));
                            $("div.img").addClass("current");
                        }
                        //alert("33");
                    });
                    $("div.img").click(function(){
                        $("div.img").removeClass("current");
                    });
                });
            </script>


        </div>
    </div>

</block>